<script type="text/javascript">
    function goImgWin(myImage, myWidth, myHeight, origLeft, origTop) {
        myHeight += 24;
        myWidth += 24;
        TheImgWin = window.open(myImage, 'image', 'height=' +
                myHeight + ',width=' + myWidth +
                ',toolbar=no,directories=no,status=no,' +
                'menubar=no,scrollbars=no,resizable=no');
        TheImgWin.resizeTo(myWidth + 2, myHeight + 30);
        TheImgWin.moveTo(origLeft, origTop);
        TheImgWin.focus();
    }
</script>

<div class="anh">
    <img id="anh1" style="cursor: pointer;" title="Xem hình lớn - <?php echo $model->title; ?>" type='123' alt="<?php echo $model->title; ?>"
         src="<?php echo $model->urlPhoto; ?>" onclick="goImgWin('<?php echo $model->urlPhoto; ?>', 480, 502, 350, 150);
        false;">
</div>

<div class="thongtin">
    <div class="spdt">
        
        <h1 style="font-size: 24px;"> <?php echo $model->title; ?></h1>
        
    </div>
    <div class="desc_sp">
        <?php echo $model->desc; ?>

    </div>
    <div style="clear: both"></div>
</div>

<div class="top_p_desctiption_bg">
    <div id="order" class="addcart" >
        Đặt hàng
    </div>
</div>
<br>
<br>
<?php
$this->widget('application.components.SocialShareWidget', array(
    'url' => $model->urlByProduct, //required
    'services' => array('google', 'twitter', 'facebook'), //optional
    'htmlOptions' => array('class' => 'shared'), //optional
    'popup' => true, //optional
));
?>
<script type="text/javascript">
    $('#order').click(function() {
        $('#light, #fade').css('display', 'block');
        var scroll = jQuery(window).scrollTop();
        $('#light').css('top', scroll + 100 + 'px');
        $('#fade').css('top', scroll + 'px');
    });
</script>
<div style="clear: both"></div>
<div class="content_p_d_b">
    <?php echo $model->content; ?>
</div>
<!--12121-->
<div class="prother">Sản phẩm khác</div>
<div class="top_sp"></div>
<div class="center_sp">
    <div class="spGridBG" name="divSP" id="spGrid_1">
        <?php if ($model_relation != NULL): ?>
            <?php foreach ($model_relation as $relation): ?>
                <div class="spGrid">
                    <div class="div1">
                        <div class="spGridTitle">
                            <a class="link_slide" href="<?php echo $relation->urlByProduct; ?>">
                                    <?php echo $relation->title; ?>
                                </a>
                            
                        </div>
                        <div class="clearfix">
                            <div class="home_img">
                                <br>
                                <a href="<?php echo $relation->urlByProduct; ?>">
                                    <img border="0" src="<?php echo $relation->urlPhoto; ?>" alt="<?php echo $relation->title; ?>">
                                </a>
                            </div>
                            <a style="cursor: pointer;text-decoration: none" rel="nofollow" class="btnorder" href="<?php echo $relation->urlByProduct; ?>" >
                                <div class="addcart" >
                                    Chi tiết
                                </div>
                            </a>
                        </div>
                    </div>
                    <div class="spGridBottom1"></div>
                </div>
            <?php endforeach; ?>
        <?php endif; ?>
        <div style="clear: both"></div>
    </div>
</div>
<div class="bottom_sp"></div>
<div id="light" class="white_content" style="height: 400px"> 
    <?php $model = new ContactForm(); ?>
    <?php
    $form = $this->beginWidget('CActiveForm', array(
        'id' => 'login-form',
        'enableAjaxValidation' => true,
        'enableClientValidation' => true,
        'action' => 'site/SendContact',
        'enableAjaxValidation' => false,
        'enableClientValidation' => true,
    ));
    ?>
    <table border="0" cellspacing="0" cellpadding="5" align="center">
        <tr>
            <td><label class="label">Tên của bạn:</label></td>
            <td>
                <?php echo $form->textField($model, 'name', array('class' => 'txt')); ?>
                <?php echo $form->error($model, 'name'); ?>
            </td>
        </tr>
        <tr>
            <td><label class="label">Địa chỉ email:</label></td>
            <td>
                <?php echo $form->textField($model, 'email', array('class' => 'txt')); ?>
                <?php echo $form->error($model, 'email'); ?>
            </td>
        </tr>
        <tr>
            <td><label class="label">Tiêu đề:</label></td>
            <td>
                <?php echo $form->textField($model, 'subject', array('class' => 'txt')); ?>
                <?php echo $form->error($model, 'subject'); ?>
            </td>
        </tr>
        <tr>
            <td><label class="label">Nội dung:</label></td>
            <td>
                <?php echo $form->textArea($model, 'body', array('cols' => 35, 'rows' => 10)); ?>
                <?php echo $form->error($model, 'body'); ?>
            </td>
        </tr>
        <tr>
            <td></td>
            <td>
                <?php echo CHtml::button('Đóng', array('class' => 'addcart', 'onclick' => "document.getElementById('light').style.display = 'none';
        document.getElementById('fade').style.display = 'none'")) ?>
                <?php
                echo CHtml::ajaxSubmitButton('Gửi đi', $this->createUrl('site/SendContact'), array(
                    'success' => 'function(data){
							if(data == "ok"){
                                                            $("#n").css("display","block");
                                                            setTimeout(function(){
                                                            
                                                            $("#light, #fade").css("display","none");
                                                                  },1500);
							}else{
								 $("#e").css("display","block");
							}
						}'
                    ), array('class' => 'addcart'));
                ?>
                <div id="n" style="display: none;font-weight: 700;font-size: 14px;color: rgb(4, 134, 221);margin: 9px 0px;">
                    Gửi yêu cầu thành công !
                </div>
                <div id="e" style="display: none;font-weight: 700;font-size: 14px;color: rgb(4, 134, 221);margin: 9px 0px;">
                    Thông tin đăng nhập bị sai !
                </div>
            </td>
        </tr>
    </table>
    <?php $this->endWidget(); ?>
</div>
<div id="fade" class="black_overlay"></div>